package org.sapidoc.idoc.generatorclass.factory;

import org.sapidoc.idoc.generatorclass.parser.writer.field.AnnotationIdocPropertyFieldWriter;
import org.sapidoc.idoc.generatorclass.parser.writer.field.IdocPropertyFieldWriter;

public class IdocPropertyFactory {

	private boolean useAnnotation = false;
	
	public IdocPropertyFieldWriter create(String name,Integer positionInSegment, Integer offset, Integer length){
		if(useAnnotation){
			return new AnnotationIdocPropertyFieldWriter(name,positionInSegment,offset,length);
		}else{
			return new IdocPropertyFieldWriter(name,positionInSegment,offset,length);
		}
	}

	public IdocPropertyFieldWriter create(String name,Integer positionInSegment, Integer offset, Integer length,String value){
		if(useAnnotation){
			return new AnnotationIdocPropertyFieldWriter(name,positionInSegment,offset,length,value);
		}else{
			return new IdocPropertyFieldWriter(name,positionInSegment,offset,length,value);
		}
	}
	
	public boolean isUseAnnotation() {
		return useAnnotation;
	}

	public void setUseAnnotation(boolean useAnnotation) {
		this.useAnnotation = useAnnotation;
	}
}
